//
//  UIColor+JwCate.h
//  JwPack
//
//  Created by 陈警卫 on 2024-07-19.
//

#import <UIKit/UIKit.h>

/// RGB颜色
#define kJwColorRGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
/// RGBA颜色
#define kJwColorRGBA(r, g, b, a)  [UIColor colorWithRed:(r)/255.f green:(g)/255.f blue:(b)/255.f alpha:(a)]
/// 随机颜色
#define kJwColorRandom kJwColorRGB(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))

/// hex颜色
#define kJwColorHex(h) [UIColor jw_colorHex:(h)]
/// hex颜色
#define kJwColorHexA(h, a) [UIColor jw_colorHex:(h) alpha:(a)]

/// hexString颜色
#define kJwColorHexString(h) [UIColor jw_colorHexString:(h)]
/// hexString颜色
#define kJwColorHexAString(h, a) [UIColor jw_colorHexString:(h) alpha:(a)]


@interface UIColor (JwCate)

/// 十六进制颜色
+ (UIColor *)jw_colorHex:(NSInteger)hex alpha:(CGFloat)alpha;

/// 十六进制颜色
+ (UIColor *)jw_colorHex:(NSInteger)hex;

/// 十六进制字符串颜色
+ (UIColor *)jw_colorHexString:(NSString *)hexString alpha:(CGFloat)alpha;

/// 十六进制字符串颜色
+ (UIColor *)jw_colorHexString:(NSString *)hexString;

/// 获取红色色值
- (CGFloat)jw_red;

/// 获取绿色色值
- (CGFloat)jw_green;

/// 获取蓝色色值
- (CGFloat)jw_blue;

/// 获取透明色值
- (CGFloat)jw_alpha;

/// 获取hue（色相）
- (CGFloat)jw_hue;

/// 获取saturation（饱和度）
- (CGFloat)jw_saturation;

/// 获取brightness（亮度）
- (CGFloat)jw_brightness;

/// 剥离掉alpha通道后得到的色值 相当于把当前颜色的半透明值强制设为1.0
- (UIColor *)jw_colorWithoutAlpha;

/// 将自身变化到某个目标颜色
- (UIColor *)jw_colorGradualToColor:(UIColor *)toColor progress:(CGFloat)progress;

/// 将颜色A渐变颜色B progress进度
+ (UIColor *)jw_colorGradualFromColor:(UIColor *)fromColor toColor:(UIColor *)toColor progress:(CGFloat)progress;

/// 计算两个颜色叠加之后的最终色（注意区分前景色后景色的顺序）
+ (UIColor *)jw_colorFuseWithBackColor:(UIColor *)backColor frontColor:(UIColor *)frontColor;

/// 获取颜色十六进制值
- (NSString *)jw_hexString;

/// 获取颜色十六进制值
- (NSString *)jw_hexStringWithAlpha;

/// 获取颜色十六进制值
- (NSString *)jw_hexStringWithAlpha:(BOOL)isAlpha;

/// 适配暗黑模式
+ (UIColor *)jw_colorDynamicWithLightColor:(UIColor *)lightColor darkColor:(UIColor *)darkColor;
/// 适配暗黑模式
+ (UIColor *)jw_colorDynamicWithLightHexString:(NSString *)lightHexString darkHexString:(NSString *)darkHexString;
/// 适配暗黑模式
+ (UIColor *)jw_colorDynamicWithLightHex:(NSInteger)lightHex darkHex:(NSInteger)darkHex;

@end

